package log

import (
	rotate "github.com/lestrrat-go/file-rotatelogs"
	log "github.com/sirupsen/logrus"
	"kuafu/progress/path"
	"time"
)

var (
	Log = log.New()
)

func init() {
	p := path.GetCurrentDir() + "/logs/app.log"
	writer, _ := rotate.New(
		p+".%Y%m%d%H%M",
		rotate.WithLinkName(p),
		rotate.WithMaxAge(time.Duration(24)*time.Hour),
		rotate.WithRotationTime(time.Duration(24*7)*time.Hour),
		rotate.WithRotationSize(1024*1024*50),
	)
	Log.SetOutput(writer)
	// 日志级别
	Log.SetLevel(log.InfoLevel)
}
